clear all 
clc
 load('COIL100.mat');	
 nClass = length(unique(gnd));
 dataset='COIL100';      
 fea=double(fea);
 
 %Sort samples by labels
 [labels,index]=sort(gnd,'ascend');
 gnd=labels;
 fea=fea(index,:);
 fea=double(fea);
 
 %Euclidean length normalization
 fea = NormalizeFea(fea); 

 LabelsRatio=0.1;
 SelectClasses=nClass; %full-size dataset as input data  
 % The values of hyperparameters in the experiments
 %dataset    PIE  MSRA25    YaleB  COIL20  AR  COIL100  MNIST Pendigits  
 %p           3     10        2       2      2    2        5     5
 %k           5      1        3       3      3    3         1    1
 %alpha   1000    1000   1000  1000  1000   1000  1000  1000 1000 1000
  p=2;
  k=3;
  alpha=1000;
 % for h=1:20
     %Select the data points of K classes as the input of the algorithm
     [X,SampGnd,SampNum]=CreatSampleDatasets(fea,SelectClasses,gnd,nClass,LabelsRatio);
     % X:selected data points belong to SelectClasses Classes
     %SampGnd: the lables of selected data points
     %SampNum: the number of selected data points
     Options.maxIter=30;
     Options.p =p;% p: Nearest neighbor parameter
     Options.k=k;
     Options.alpha=alpha;
     Options.SampNum=SampNum;
     Options.SampGnd=SampGnd;
     Options.SelectClasses=SelectClasses;
      [~,V, ~]=HLPNMF(X,Options);
      [~, label] = max(V');
       results = ClusteringEvaluationMetrics(SampGnd(SampNum+1:end), label(SampNum+1:end) )
 % end
 

 
 
    
 